package cn.findviewbydream.evil.bigtoutiao.base;


import android.app.Fragment;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import butterknife.ButterKnife;
import butterknife.Unbinder;

/********************************************
 * 工程名：MOtoWaiter
 * 包名：cn.findviewbydream.evil.motowaiter.base
 * 时间：17-1-17
 * 作者：白雨濃 evil
 * 邮箱：evilbai@foxmail.com
 * 内容：
 ********************************************/
public abstract class BaseFragment extends Fragment
{
    protected View root;
    protected Unbinder unbinder;

    @LayoutRes
    public abstract int setFragmentViewId();

    public abstract void setFragmentCreateView();

    protected abstract void initView();

    public void setFragmentCreate()
    {

    }


    @Override
    public final void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setFragmentCreate();
    }

    @Nullable
    @Override
    public final View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
    {
        root = inflater.inflate(setFragmentViewId(), container, false);
        unbinder = ButterKnife.bind(this, root);
        setFragmentCreateView();
        return root;
    }

    @Override
    public void onStart()
    {
        super.onStart();
    }

    @Override
    public void onDestroy()
    {
        super.onDestroy();
        unbinder.unbind();
    }

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data)
    {
        super.onActivityResult(requestCode, resultCode, data);
    }
}
